﻿namespace WanPiJie.Products
{
	using System;


	/// <summary>
	/// 表名：pt_ProductAttribute 主键列：Id
	/// </summary>
	[SerializableAttribute()]
	public partial class _ProductAttribute : MySoft.Data.Entity
	{

		protected Int64 _Id;

		protected Int64 _AttributeId;

		protected Int64 _CatalogId;

		protected String _Name;

		protected DateTime _AddTime;

		protected DateTime _UpdateTime;

		public Int64 Id
		{
			get
			{
				return this._Id;
			}
			set
			{
				this.OnPropertyValueChange(_.Id, _Id, value);
				this._Id = value;
			}
		}

		public Int64 AttributeId
		{
			get
			{
				return this._AttributeId;
			}
			set
			{
				this.OnPropertyValueChange(_.AttributeId, _AttributeId, value);
				this._AttributeId = value;
			}
		}

		public Int64 CatalogId
		{
			get
			{
				return this._CatalogId;
			}
			set
			{
				this.OnPropertyValueChange(_.CatalogId, _CatalogId, value);
				this._CatalogId = value;
			}
		}

		public String Name
		{
			get
			{
				return this._Name;
			}
			set
			{
				this.OnPropertyValueChange(_.Name, _Name, value);
				this._Name = value;
			}
		}

		public DateTime AddTime
		{
			get
			{
				return this._AddTime;
			}
			set
			{
				this.OnPropertyValueChange(_.AddTime, _AddTime, value);
				this._AddTime = value;
			}
		}

		public DateTime UpdateTime
		{
			get
			{
				return this._UpdateTime;
			}
			set
			{
				this.OnPropertyValueChange(_.UpdateTime, _UpdateTime, value);
				this._UpdateTime = value;
			}
		}

		/// <summary>
		/// 获取实体对应的表名
		/// </summary>
		protected override MySoft.Data.Table GetTable()
		{
			return new MySoft.Data.Table<_ProductAttribute>("pt_ProductAttribute");
		}

		/// <summary>
		/// 获取实体中的标识列
		/// </summary>
		protected override MySoft.Data.Field GetIdentityField()
		{
			return _.Id;
		}

		/// <summary>
		/// 获取实体中的主键列
		/// </summary>
		protected override MySoft.Data.Field[] GetPrimaryKeyFields()
		{
			return new MySoft.Data.Field[] {
    					_.Id};
		}

		/// <summary>
		/// 获取列信息
		/// </summary>
		protected override MySoft.Data.Field[] GetFields()
		{
			return new MySoft.Data.Field[] {
    					_.Id,
    					_.AttributeId,
    					_.CatalogId,
    					_.Name,
    					_.AddTime,
    					_.UpdateTime};
		}

		/// <summary>
		/// 获取列数据
		/// </summary>
		protected override object[] GetValues()
		{
			return new object[] {
    					this._Id,
    					this._AttributeId,
    					this._CatalogId,
    					this._Name,
    					this._AddTime,
    					this._UpdateTime};
		}

		/// <summary>
		/// 给当前实体赋值
		/// </summary>
		protected override void SetValues(MySoft.Data.IRowReader reader)
		{
			if ((false == reader.IsDBNull(_.Id)))
			{
				this._Id = reader.GetInt64(_.Id);
			}
			if ((false == reader.IsDBNull(_.AttributeId)))
			{
				this._AttributeId = reader.GetInt64(_.AttributeId);
			}
			if ((false == reader.IsDBNull(_.CatalogId)))
			{
				this._CatalogId = reader.GetInt64(_.CatalogId);
			}
			if ((false == reader.IsDBNull(_.Name)))
			{
				this._Name = reader.GetString(_.Name);
			}
			if ((false == reader.IsDBNull(_.AddTime)))
			{
				this._AddTime = reader.GetDateTime(_.AddTime);
			}
			if ((false == reader.IsDBNull(_.UpdateTime)))
			{
				this._UpdateTime = reader.GetDateTime(_.UpdateTime);
			}
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		public override bool Equals(object obj)
		{
			if ((obj == null))
			{
				return false;
			}
			if ((false == typeof(_ProductAttribute).IsAssignableFrom(obj.GetType())))
			{
				return false;
			}
			if ((((object)(this)) == ((object)(obj))))
			{
				return true;
			}
			return false;
		}

		public class _
		{

			/// <summary>
			/// 表示选择所有列，与*等同
			/// </summary>
			public static MySoft.Data.AllField All = new MySoft.Data.AllField<_ProductAttribute>();

			/// <summary>
			/// 字段名：Id - 数据类型：Int64
			/// </summary>
			public static MySoft.Data.Field Id = new MySoft.Data.Field<_ProductAttribute>("Id");

			/// <summary>
			/// 字段名：AttributeId - 数据类型：Int64
			/// </summary>
			public static MySoft.Data.Field AttributeId = new MySoft.Data.Field<_ProductAttribute>("AttributeId");

			/// <summary>
			/// 字段名：CatalogId - 数据类型：Int64
			/// </summary>
			public static MySoft.Data.Field CatalogId = new MySoft.Data.Field<_ProductAttribute>("CatalogId");

			/// <summary>
			/// 字段名：Name - 数据类型：String
			/// </summary>
			public static MySoft.Data.Field Name = new MySoft.Data.Field<_ProductAttribute>("Name");

			/// <summary>
			/// 字段名：AddTime - 数据类型：DateTime
			/// </summary>
			public static MySoft.Data.Field AddTime = new MySoft.Data.Field<_ProductAttribute>("AddTime");

			/// <summary>
			/// 字段名：UpdateTime - 数据类型：DateTime
			/// </summary>
			public static MySoft.Data.Field UpdateTime = new MySoft.Data.Field<_ProductAttribute>("UpdateTime");
		}
	}
}